#include <iostream>
#include <cstdio>
#include <vector> 
#include <algorithm>

using namespace std; 

struct admirer_t {
	int id; 
	int w; 
	int final_w; 
}; 

bool cmp_w(admirer_t &a, admirer_t &b) 
{
	return a.w==b.w ? (a.id<b.id) : (a.w>b.w); 
}

bool cmp_final_w(admirer_t &a, admirer_t &b) 
{
	return a.final_w==b.final_w ? (a.id<b.id) : (a.final_w>b.final_w); 
}

int main()
{
	int i, n, k, t; 
	admirer_t a; 
	vector <admirer_t> ad; 
	vector <int> e; 
	
	//freopen("p1583_1.in", "r", stdin); 
	
	cin>>n>>k; 
	for (i=0; i<10; i++) {
		cin>>t; 
		e.push_back(t); 
	}
	for (i=0; i<n; i++) {
		a.id = i+1; 
		cin>>a.w; 
		ad.push_back(a); 
	}
	sort(ad.begin(), ad.end(), cmp_w); 

/*	cout<<"e:"<<"\n"; 
	for (i=0; i<10; i++) {
		cout<<e[i]<<" "; 
	}
	cout<<"\n"; 

	cout<<"first:"<<endl;
	for (i=0; i<n; i++) {
		cout<<ad[i].id<<" "; 
	}
	cout<<"\n"; 
*/
	for (i=0; i<n; i++) {
		t = i%10; 
		ad[i].final_w = e[t] + ad[i].w; 
//		cout<<"id="<<ad[i].id<<", t="<<t<<", e="<<e[t]<<", final_w="<<ad[i].final_w<<endl; 
	}
	sort(ad.begin(), ad.end(), cmp_final_w); 
	for (i=0; i<k; i++) {
		cout<<ad[i].id<<" "; 
	}
	cout<<"\n"; 
	return 0; 
}


